/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package DLL;

import java.io.*;
import java.util.Date;

/**
 *
 * @author PyyPyLyn
 */
public class WriteLog {
    
    public static void WriteLog(String FileName, boolean IsTransfer, String IP) throws IOException
    {
        String log = new Date().toString()+": ";
        if (IsTransfer == true)
        {
            log += "UPLOAD: ";
        }
        else
        {
            log += "DOWNLOAD: ";
        }
        log += FileName +" : " +IP;
        
        try
        {
            FileWriter fw = new FileWriter("log.log", true);
            fw.write(log + "\r\n");
            fw.close();
        }
        catch (IOException e)
        {
            File logfile = new File("log.log");
            FileWriter fw = new FileWriter(logfile);
            fw.write(log + "\r\n");
            fw.close();
        }
              
    }
    
}
